Jan-Philipp Kolb
04/13/2015
A road map is one of the most widely used map types.
These maps show major and minor highways and roads (depending on detail)
as well as things like airports, city locations and points of interest like parks, campgrounds and monuments.
Major highways on a road map are generally red and larger than other roads,
while minor roads are a lighter color and a narrower line.
library(ggmap)
qmap("Mannheim")
MA_map <- qmap("Mannheim",zoom=14)
library()qmap(location = 'Mannheim', zoom = 12)
qmap(location = 'Mannheim', zoom = 13)
qmap(location = 'Mannheim', zoom = 20)
qmap(location = 'Mannheim', zoom = 14, source="osm")
qmap(location = 'Mannheim', zoom = 14, maptype="satellite")
qmap(location = 'Mannheim', zoom = 14, maptype="hybrid")
qmap(location = 'Mannheim', zoom = 14,
maptype="toner",source="stamen")
MA_map <- qmap(location = 'Mannheim', zoom = 14,
maptype="toner",source="stamen")
Geocoding (…) uses a description of a location, most typically a postal address or place name, to find geographic coordinates from spatial reference data …
geocode("Mannheim Wasserturm",source="google")
| lon | lat |
|---|---|
| 8.462233 | 49.48371 |
mapdist("Q1, 4 Mannheim","B2, 1 Mannheim")
## from to m km miles seconds minutes
## 1 Q1, 4 Mannheim B2, 1 Mannheim 746 0.746 0.4635644 211 3.516667
## hours
## 1 0.05861111
mapdist("Q1, 4 Mannheim","B2, 1 Mannheim",mode="walking")
## from to m km miles seconds minutes
## 1 Q1, 4 Mannheim B2, 1 Mannheim 546 0.546 0.3392844 420 7
## hours
## 1 0.1166667
mapdist("Q1, 4 Mannheim","B2, 1 Mannheim",mode="bicycling")
## from to m km miles seconds minutes
## 1 Q1, 4 Mannheim B2, 1 Mannheim 555 0.555 0.344877 215 3.583333
## hours
## 1 0.05972222
POI1 <- geocode("B2, 1 Mannheim",source="google")
POI2 <- geocode("Hbf Mannheim",source="google")
POI3 <- geocode("Wasserturm Mannheim",source="google")
ListPOI <-rbind(POI1,POI2,POI3)
POI1;POI2;POI3
## lon lat
## 1 8.462844 49.48569
## lon lat
## 1 8.469879 49.47972
## lon lat
## 1 8.473664 49.48483
MA_map +
geom_point(aes(x = lon, y = lat),
data = ListPOI)
MA_map +
geom_point(aes(x = lon, y = lat),col="red",
data = ListPOI)
ListPOI$color <- c("A","B","C")
MA_map +
geom_point(aes(x = lon, y = lat,col=color),
data = ListPOI)
ListPOI$size <- c(10,20,30)
MA_map +
geom_point(aes(x = lon, y = lat,col=color,size=size),
data = ListPOI)
More about adding points
ggmap: Spatial Visualization with ggplot2
by David Kahle and Hadley Wickham